]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/password-entry: Update input hints when toggling password visibility
authorJoan Torres Lopez <joantolo@redhat.com>
Thu, 29 Jan 2026 12:46:19 +0000 (13:46 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 3 Feb 2026 16:29:20 +0000 (16:29 +0000)
Set the HIDDEN_TEXT hint when the password is hidden and remove it
when shown. This ensures IBus is aware when it should hide pre-edit
text.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4053>

src/st/st-password-entry.c

index b55d7b1daf6704c9b81914da98c0f063663d6719..8c6204f37bd56e53356a05453dddcefbeb477701 100644 (file)
@@ -238,6 +238,7 @@ st_password_entry_init (StPasswordEntry *entry)
   clutter_text_set_password_char (clutter_text, BLACK_CIRCLE);
 
   st_entry_set_input_purpose (ST_ENTRY (entry), CLUTTER_INPUT_CONTENT_PURPOSE_PASSWORD);
+  st_entry_set_input_hints (ST_ENTRY (entry), CLUTTER_INPUT_CONTENT_HINT_HIDDEN_TEXT);
 
   g_signal_connect (clutter_text, "notify::password-char",
                     G_CALLBACK (clutter_text_password_char_cb), entry);
@@ -317,6 +318,7 @@ st_password_entry_set_password_visible (StPasswordEntry *entry,
 {
   StPasswordEntryPrivate *priv;
   ClutterText *clutter_text;
+  ClutterInputContentHintFlags hints;
 
   g_return_if_fail (ST_IS_PASSWORD_ENTRY (entry));
 
@@ -331,11 +333,19 @@ st_password_entry_set_password_visible (StPasswordEntry *entry,
     {
       clutter_text_set_password_char (clutter_text, 0);
       st_icon_set_icon_name (ST_ICON (priv->peek_password_icon), "view-conceal-symbolic");
+
+      hints = st_entry_get_input_hints (ST_ENTRY (entry));
+      hints &= ~CLUTTER_INPUT_CONTENT_HINT_HIDDEN_TEXT;
+      st_entry_set_input_hints (ST_ENTRY (entry), hints);
     }
   else
     {
       clutter_text_set_password_char (clutter_text, BLACK_CIRCLE);
       st_icon_set_icon_name (ST_ICON (priv->peek_password_icon), "view-reveal-symbolic");
+
+      hints = st_entry_get_input_hints (ST_ENTRY (entry));
+      hints |= CLUTTER_INPUT_CONTENT_HINT_HIDDEN_TEXT;
+      st_entry_set_input_hints (ST_ENTRY (entry), hints);
     }
 
   g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_PASSWORD_VISIBLE]);